# -*- mode: snippet -*-
# name: windowsFonts template from grDevices
# key: windowsFonts@grDevices
# key: font.windowsFonts
# contributor: Shuguang Sun
# --
windowsFonts(
  # 中文字体
  lishu = windowsFont(family = "LiSu"),            # 隶书
  yahei = windowsFont(family = "Microsoft YaHei"), # 微软雅黑
  xinwei = windowsFont(family = "STXingwei"),      # 华文新魏
  kaiti = windowsFont(family = "KaiTi"),           # 楷体
  heiti = windowsFont(family = "SimHei"),          # 黑体
  # 英文字体
  arial = windowsFont(family = "Arial"),             # Arial字体
  newman = windowsFont(family = "Times New Roman"),  # Times New Roman字体
  hand = windowsFont(family = "Lucida Calligraphy"), # Lucida手写体
  Helvetica = windowsFont(family = "Helvetica")      # 印刷体
  )
ggplot(mtcars) +
  geom_point(aes(x = mpg, y = drat)) +
  # 中文字体
  annotate(geom = "text", x = 15, y = 4.5, label = "隶书", size = 18, color = "tomato2", family = "lishu") +
  annotate(geom = "text", x = 26, y = 4.5, label = "微软雅黑", size = 18, color = "tomato2", family = "yahei") +
  annotate(geom = "text", x = 15, y = 3.8, label = "楷体", size = 18, color = "tomato2", family = "kaiti") +
  annotate(geom = "text", x = 25, y = 3.8, label = "黑体", size = 18, color = "tomato2", family = "heiti") +
  annotate(geom = "text", x = 18, y = 3.0, label = "华文新魏", size = 18, color = "tomato2", family = "xinwei") +
  # 英文字体
  annotate(geom = "text", x = 18, y = 3.5, label = "Arial Font", size = 12, color = "tomato2", family = "arial") +
  annotate(geom = "text", x = 20, y = 4.8, label = "Times New Roman", size = 12, color = "tomato2", family = "newman") +
  annotate(geom = "text", x = 30, y = 3.0, label = "Lucida", size = 12, color = "tomato2", family = "hand") +
  annotate(geom = "text", x = 30, y = 3.5, label = "Helvetica", size = 12, color = "tomato2", family = "Helvetica")